<%= render 'nav' %>

<h4>Top 10 - <%= Date.current.strftime('%Y年%m月') %></h4>

<style>
  .table th.align-right, .table td.align-right {
      text-align: right;
  }
</style>
<table class="table table-striped">
  <thead>
      <tr class="red" style="color: #bd200b;">
        <th colspan="2">合计</th>
        <th class="align-right"><%= @total_number.to_s(:delimited) %></th>
        <th class="align-right"><%= @total_price.round.to_s(:delimited) %></th>
      </tr>
      <tr style="color: #ff5412;">
        <th>名次</th>
        <th>姓名</th>
        <th class="align-right">销售量</th>
        <th class="align-right">销售额</th>
      </tr>
  </thead>
  <tbody>

  <% @top10_salers.each_with_index do |saler, index| %>
  <tr>
    <td><%= index.next %></td>
    <td><%= saler.staff.name_or_email %></td>
    <td class="align-right"><%= saler.total_number.to_s(:delimited) %></td>
    <td class="align-right"><%= saler.total_price.round.to_s(:delimited) %></td>
  </tr>
  <% end %>
  </tbody>

</table>
